package zj.com.activities;

import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import zj.com.zj.R;

/**
 * Created by xi on 16/6/21.
 *
 * 输入
 */
public class SelectInputActivity extends  BaseActivity implements View.OnClickListener{


    public TextView title_name,right_tv;
    public ImageView left_iv;
    public EditText search_et;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_select_input);
        initView();
    }

    public void initView(){
        title_name = (TextView) findViewById(R.id.title_name);
        title_name.setText("选择");
        left_iv = (ImageView) findViewById(R.id.left_iv);
        left_iv.setVisibility(View.VISIBLE);
        left_iv.setOnClickListener(this);

        right_tv = (TextView) findViewById(R.id.right_tv);
        right_tv.setText("确定");
        right_tv.setVisibility(View.VISIBLE);
        right_tv.setOnClickListener(this);

        search_et = (EditText) findViewById(R.id.search_et);
    }

    @Override
    public void onClick(View v) {

        switch (v.getId()){
            case R.id.left_iv:
                finish();
                break;
            case R.id.right_tv:


                doSumbit();
                break;
        }
    }

    public void doSumbit(){

        String keyword = search_et.getText().toString();

        Intent intent  = new Intent();
        intent.putExtra("keyword",keyword);
        setResult(RESULT_OK,intent);
        finish();
    }
}
